<?php
/* @var $this MasterAkunController */
/* @var $model MasterAkun */
/* @var $form CActiveForm */
?>
<script>
function changeAkunKode(){
	var id = $("#MasterAkun_KODE").val($('#MasterAkun_ID_KEL_AKUN').val());
	$.ajax({
	   type: "POST",
	   url: "<?php echo Yii::app()->request->baseUrl;?>/index.php/MasterAkun/getLastAkun",
	   data: id,
	   cache: false,
	   success: function(data){
		$("#MasterAkun_KODE").val(data);
	  }
	});	
};
</script>
<div id="steps">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'master-akun-form',
	'enableAjaxValidation'=>false,
)); ?>

	<?php echo $form->errorSummary($model); ?>
<fieldset class="step">
	<p>
		<?php echo $form->label($model,'NAMA_AKUN'); ?>
		<?php echo $form->textField($model,'NAMA_AKUN',array('size'=>30,'maxlength'=>30)); ?>
		<?php echo $form->error($model,'NAMA_AKUN'); ?>
	</p>

	<p>
		<label for="TipeAkun">Tipe Akun</label>
		<?php 
		echo CHtml::dropDownList('tipeakun','',array("1"=>'Akun Pokok','2'=>'Akun Cabang'),array(
		'prompt'=>'Pilih Tipe Akun',          //
		'value'=>'0',
		'ajax' => array(
		'type'=>'POST', //request type
		'url'=>Yii::app()->request->baseUrl.'/index.php/MasterAkun/getTipeAkun',
		'update'=>'#MasterAkun_ID_KEL_AKUN', //selector to update
		'data'=>array('id'=>'js:this.value'),
		))); 
		?>
	</p>
	
	<p>
		<?php echo $form->label($model,'ID_KEL_AKUN'); ?>
		<?php echo $form->DropDownList($model,'ID_KEL_AKUN',array(),array("onChange"=>"changeAkunKode()",'prompt'=>'-- Pilih Akun --')); ?>
		<?php echo $form->error($model,'ID_KEL_AKUN'); ?>
	</p>
	
	<p>
		<?php echo $form->label($model,'KODE'); ?>
		<?php echo $form->textField($model,'KODE',array('readonly'=>'readonly')); ?>
		<?php echo $form->error($model,'KODE'); ?>
	</p>

	<p>
		<?php echo $form->label($model,'PAJAK'); ?>
		<?php echo $form->textField($model,'PAJAK'); ?>
		<?php echo $form->error($model,'PAJAK'); ?>
	</p>

	<p>
		<?php echo $form->label($model,'SALDO_AWAL'); ?>
		<?php echo $form->textField($model,'SALDO_AWAL'); ?>
		<?php echo $form->error($model,'SALDO_AWAL'); ?>
	</p>

	<p>
		<?php echo $form->label($model,'SALDO'); ?>
		<?php echo $form->textField($model,'SALDO'); ?>
		<?php echo $form->error($model,'SALDO'); ?>
	</p>

	<p>
		<?php echo $form->label($model,'KETERANGAN'); ?>
		<?php echo $form->textField($model,'KETERANGAN',array('size'=>60,'maxlength'=>255)); ?>
		<?php echo $form->error($model,'KETERANGAN'); ?>
	</p>

	<p class="submit">
		<button id="registerButton" type="submit">Simpan</button>&nbsp;
		<button id="registerButton" type="reset">Reset</button>&nbsp;
		<button id="registerButton" type="button" onclick="window.location.href='<?php echo Yii::app()->createUrl("MasterAkun");?>'">Kembali</button>
	</p>

<?php $this->endWidget(); ?>

</div><!-- form -->